<template>
	<view class="contoan">
		<top-back-navbar position="fixed" title="商品购买" background="#040A1A" color="#fff"></top-back-navbar>
		<cxsytabbars :current="0" style="position: relative;z-index: 1;"></cxsytabbars>
		<!-- 商品列表 -->
		<view class="shop_item_box">
			
			<view class="item" v-for="item in goods_info" @click="todetails(item)">
				<image :src="item.thumb" style="width: 100%;height: 62%;border-radius: 8px;" mode=""></image>
				
				<view class="" style="width: 90%;height: 38%;margin: 0 auto;">
					<view class="num" style="font-weight: 900;font-size: 12px;white-space: nowrap; overflow: hidden;  letter-spacing: 1px;text-overflow: ellipsis;line-height: 17px;margin-top: -6px;">
						{{item.title}}
					</view>
					<view class="" style="font-weight: 800;display: flex;justify-content: space-between;padding: 0 3px;">
						<view class="num" style="font-size: 14px;line-height: 17px;  letter-spacing: 1px;">
							¥{{item.marketprice}}
						</view>
						
					</view>
					<view class="" style="padding: 0 3px;">
						<view class=""  style="color: #fff;font-size: 10px;line-height: 17px;  letter-spacing: 1px;">
							仓量:&nbsp;{{item.cangliang}}
						</view>
						<view class="" style="color: #fff;font-size: 10px;line-height: 15px;  letter-spacing: 1px;">
							粮票:&nbsp;{{item.kuangshi}}
						</view>
						<view class="" style="letter-spacing: 1px;background-color: #7316F3; font-size: 10px;color: #fff;border-radius: 50px;padding:3px 12px;line-height: 10px;text-align: center;">
							购买
						</view>
					</view>
				</view>
				
			</view>
			
		</view>
					


	
	</view>
</template>

<script>
	export default {
		data() {
			return {


				page: 1,
				cate: 1294,
				res: [],
				res_list: [],
				goods_info:[]

			};
		},
		onLoad: function(e) {
			console.log(e);
			this.getGoodsList(e.gift)
		},
		methods: {
			getGoodsList(gift) {

				// if(!this.contentText)return;
				uni.showLoading()
				uni.request({
					url: this.$BASE_URL +
						'/index.php?i=2&c=entry&m=ewei_shopv2&do=mobile&r=goods.get_list&keywords=&isrecommand=&ishot=&isnew=&isdiscount=&issendfree=&istime=&order=&by=&merchid=&gift=' +
						gift,

					success: res => {
						let list = Array.isArray(res.data.result.list) ? res.data.result.list : []
						console.log(list);
						
						this.goods_info = list
					},
					fail: () => {},
					complete: () => {
						uni.hideLoading();
					}
				});
			},
			todetails(item) {
				var path = `/pages/goods/detail?goodsid=${item.id}&type='cxsy'`
				uni.navigateTo({
					url: path
				});

			},
		}
	}
</script>

<style lang="less">
	* {
		margin: 0;
		padding: 0;
	}
.num{

		background: linear-gradient(to bottom, #FBEDB9, #FFB85C, );
		align-items: center;
		background-clip: text;
		color: transparent;

	}
	page {
		height: 100%;
		width: 100vw;
		height: 180vh;
		background: url('/static/zn/home_bg.png') 0 0 no-repeat;
		background-size: 150% 106%;
		position: relative;
		overflow: auto;

	}

	.contoan {
		width: 100vw;
		padding: 40rpx 15px;
	}

	.shop_item_box{
		width: 100%;
		background: url('/static/zn/jifen_box.png') 0 0 no-repeat;
		background-size: 100% 100%;
		display: flex;
		justify-content: center;
		flex-wrap: wrap;
		padding: 10px 0;
		.item{
			
			margin-top: 10rpx;
			width: 43vw;
			height: 63vw;
			background-color: #fff;
			background: url('/static/zn/home_shop_item_box.png') 0 0 no-repeat;
			background-size: 100% 100%;
			padding: 9px;
			
		}
	}
	.shop_item_box{
		.title{
			width: 100%;
			text-align: center;
			color: #F4D8B2;
			font-size: 20px;
			font-weight: 800;
		}
		.price{
			width: 100%;
			text-align: center;
			color: #F4D8B2;
			font-size: 20px;
			font-weight: 800;
		}
	}
</style>